package hust.hiepdv.javaproject.model;

import java.awt.Image;
import java.awt.Point;
import java.awt.Toolkit;
import java.util.ArrayList;

import javax.swing.ImageIcon;

public class Table extends DrawableObject {

	public static final int STYLE_1 = 1;
	public static final String STYLE_1_DIR = "pic\\table_style_1.png";

	//private ArrayList<Line> borders;
	int[] polyXs; 
	int[] polyYs;

	/*
	 * public Table(int x, int y, Image image) { super(x, y, image); }
	 */

	public Table(int x, int y, int style) {
		super(x, y, null);
		// array stored x Axis and y Axis of all points that make border of the
		// talbe,
		// at even position is x, at odd position is y
		//borders = new ArrayList<Line>();
		int[] points = { 50, 25, 550, 25, 550, 50, 575, 50, 575, 550, 550, 550,
				550, 575, 50, 575, 50, 550, 25, 550, 25, 50, 50, 50 };
		polyXs = new int[] { 50, 550, 550, 575, 575, 550, 550, 50, 50, 25, 25, 50 }; 
		polyYs = new int[] { 25, 25, 50, 50, 550, 550, 575, 575, 550, 550, 50, 50 };
		//Line line;
		/*for (int i = 0; i < points.length - 4; i = i + 2) {
			line = new Line(points[i], points[i + 1], points[i + 2],
					points[i + 3]);
			borders.add(line);
		}*/

		Image tableStyle = null;

		switch (style) {
		case STYLE_1:
			// tableStyle = new ImageIcon(STYLE_1_DIR).getImage();
			tableStyle = Toolkit.getDefaultToolkit().getImage(STYLE_1_DIR);
			break;
		default:
			break;
		}

		setImage(tableStyle);
		setHeight(tableStyle.getHeight(null));
		setWidth(tableStyle.getWidth(null));
	}

	/*public ArrayList<Line> getBorders() {
		return borders;
	}*/
}
